package LCP;

import java.util.Arrays;

public class LCP2 {
    public static void main(String[] args) {
        LCP2 lcp2 = new LCP2();
        System.out.println(Arrays.toString(lcp2.fraction(new int[]{3, 2, 0, 2})));
    }
    public int[] fraction(int[] cont) {
        int len = cont.length;
        int mother = cont[len-1];
        int son = 1;
        for (int i = cont.length-2; i >=0; i--) {
            int temp = son;
            son = mother;
            mother = cont[i]*mother + temp;
        }
        return new int[]{mother,son};
    }
}
